<?php
/**
 * Created by PhpStorm.
 * User: shkj
 * Date: 2020/4/19
 * Time: 22:07
 */

namespace app\api\controller\v1;
use think\facade\Request;

class Address extends Base
{
    private $obj;
    public function __construct() {

        $this->obj = model("Address");
    }

    public function select(){
        $this->obj->select();
    }

    public function add(){
        $data = Request::param();
       
        $uid = $data['uid']; 
        $token = Request()->header('Token');
        $status = $this->verifyToken($uid,$token);
      
        // die;
        if($token && $status){
           $this->obj->add($data);

        }else{
            return_json(40001,'token过期了',40001);
        }
    }

    public function detail(){
        $id = Request::param('id');
        $this->obj->detail($id);
    }

    public function delete(){
        $id = Request::param('id');
        $this->obj->del($id);
    }

    public function edit(){
        $data = Request::post();
        $this->obj->modify($data);
    }

    public function det(){
        $uid = Request::param('uid');
        $this->obj->det($uid);
    }
}